/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package book;

import javax.swing.JOptionPane;

public class ConnectTest {

    static public ConnectDB myConnect;
    public static String port, user, pass, server, database_name;
    public static String name_user;
    
    public ConnectTest(){
        
    }
    public void Connect() {
        try {
            myConnect = new ConnectDB();
            if (myConnect.openConnect()) {
                JOptionPane.showMessageDialog(null, "Connection", "Connection successful!!", JOptionPane.WARNING_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null,"Error Connection", "Can't Connect to Database",JOptionPane.WARNING_MESSAGE);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static boolean ConnectWithParameters(String port, String user, String pass, String database, String server) {
        try {
            myConnect = new ConnectDB(port, user, pass, database, server);
            if (myConnect.openConnect()) {
                
                return true;
            } else {
               
                return false;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    public static void DisConnect() {
        myConnect.closeConnect();
    }
}
